package com.xm.xmapp.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.xm.xmapp.R;
import com.xm.xmapp.base.MyBaseAdapter;
import com.xm.xmapp.base.ViewHolder;
import com.xm.xmapp.response.bean.ResponsePileOrderList;

public class PileOrderListAdapter extends MyBaseAdapter<ResponsePileOrderList> {

	public PileOrderListAdapter(ArrayList<ResponsePileOrderList> list,
			Activity activity, int layoutId) {
		super(list, activity, layoutId);

	}


	@Override
	public void setValues(ViewHolder holder, final ResponsePileOrderList t,
			int position) {

		holder.setText(R.id.name, "运营商："+t.charging_order_equipment_name);
		holder.setText(R.id.time, "消费日期：" + t.charging_order_start_time);
		holder.setText(R.id.money, "扣费金额：" + t.charging_total_money);
		holder.setText(R.id.power, "充电电量：" + t.charging_total_power);

		TextView status = (TextView) holder.getView(R.id.status);
		status.setText("去支付");
		switch (t.order_status) {
		case 0:
			status.setVisibility(View.VISIBLE);

			break;
		case 1:
			status.setVisibility(View.INVISIBLE);
			break;

		default:
			status.setVisibility(View.INVISIBLE);
			break;
		}
		// 2=充电中 4=充电完成
		switch (t.charging_order_status) {
		case 2:
			status.setText("充电中");
			status.setVisibility(View.VISIBLE);
//			holder.setText(R.id.time, "充电时长：" + t.charging_order_start_time);
			break;
		case 4:

			break;
		default:
			break;
		}

	

		holder.getConvertView().setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (in != null)
					in.DoSomeThing(t);

			}
		});

	}

}
